﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Routing.Constraints;
using System.Web.Routing;

namespace blackhouse.WebNemo.Mvc.Setup {
    public class RouteConfig {
        public static void RegisterRoutes(RouteCollection routes) {
            routes.MapRoute(
                name: "FullImageCache",
                url: "nemo-file/{cache}/{size}/{groupId}/{column}/{id}/{filename}",
                defaults: new
                {
                    controller = "Nemo",
                    action = "PreviewFile"
                },
                constraints: new
                {
                    size = @"^\d*x*\d*$",
                    groupId = new IntRouteConstraint(),
                    id = new IntRouteConstraint()
                });

            routes.MapRoute(
                name: "FullImage",
                url: "nemo-file/{size}/{groupId}/{column}/{id}/{filename}",
                defaults: new
                {
                    controller = "Nemo",
                    action = "PreviewFile",
                    cache = UrlParameter.Optional
                },
                constraints: new
                {
                    size = @"^\d*x*\d*$",
                    groupId = new IntRouteConstraint(),
                    id = new IntRouteConstraint()
                });
        }
    }
}
